package com.apposcopy.ella.runtime;

import android.util.Log;

public class WorkerThreadSynchronizer extends Recorder {

	@Override
	public void synchronizeWorker() {
		try{
			Log.d("WorkerThreadSynchronizer", Thread.currentThread().getName() + " before acquire semaphore");
			Ella.getWaitingThreadsSemaphore().acquire();
			Ella.incWaitingThreads();
			Log.d("WorkerThreadSynchronizer", Thread.currentThread().getName() + " inc count");
			Ella.getWaitingThreadsSemaphore().release();
			Log.d("WorkerThreadSynchronizer", Thread.currentThread().getName() + " release semaphore");
			Ella.getSignalSemaphore().acquire();
		}catch(Exception e){
			Log.e("WorkerThreadSynchronizer", e.getMessage());
		}
	}
	
}
